RGBA转换为RGB格式
 if type(imgFile)==str and imgFile.endswith(('.bmp', '.gif', '.png')):
      with Image.open(imgFile) as im:
          im.convert('RGB').save(imgFile[:-3]+'jpg')  
#imgFile is picture's name

for infile in glob.glob('C:\Python35/*.png'):
    outfile=infile.convert('RGB').save('jpg')
    if infile!=outfile:
        try:
            Image.open(infile).save(outfile)
out = im.resize((128,128))#以画布布置一张图
im = im.rotate(90)   #逆时针旋转90度
im = im.transpose(Image.ROTATE_180)  #逆时针旋转180度其实和上面一样
im = im.transpose(Image.FLIP_LEFT_RIGHT)   #水平翻转
im = im.transpose(Image.FLIP_TOP_BOTTOM)  #垂直翻转

Image.new(mode,size,color=None)
newIm = Image.new (“RGBA”, (640, 480), (255, 0, 0)) #新建一个image对象creating images from scratch

#双重曝光？
Image.blend(i1,i2,a)  -- (p1 x (1 - a) + p2 x a)
Im2 = Image.open("background.jpg").convert(Im1.mode)
Im2 = Im2.resize(Im1.size)
img = Image.blend(Im1,Im2,0.2)

裁剪#im仍然完好
box=(0,0,100,100)#以左上角为原点
region=im.crop(box)
region.show()
region=region.rotate(90)
im.paste(region,box)
im.show()

r,g,b=im.split()#r,g,b could show()
new=Image.merge(im.mode,(r,g,b))

im_0 = ImageEnhance.CLASS(im02).enhance(0.0)
'CLASS=Color,Brightness,Contrast'

im.filter(ImageFilter.MedianFilter) #中值滤波

import pytesseract
text=pytesseract.image_to_string(im,lang='chi_sim')
text=text.replace(' ','')
print(text)